//
//  StarModel.m
//  MyPopStar
//
//  Created by tarena on 16/1/6.
//  Copyright © 2016年 ssnb. All rights reserved.
//

#import "StarModel.h"

@implementation StarModel
mdealloc

-(CGRect)mFrame{
    return CGRectMake(starSide*self.starPoint.column, starSide*(9-self.starPoint.row), starSide, starSide);
}
-(NSString *)dress{
    return [NSString stringWithFormat:@"{%ld,%ld}",self.starPoint.column,self.starPoint.row];
}


-(void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeObject:[NSNumber numberWithInt:self.starModelType] forKey:@"starModelType"];
    [aCoder encodeObject:[NSValue valueWithCGRect:self.mFrame] forKey:@"mFrame"];
    [aCoder encodeObject:[NSNumber numberWithInteger:self.starPoint.column] forKey:@"starPointcolumn"];
    [aCoder encodeObject:[NSNumber numberWithInteger:self.starPoint.row] forKey:@"starPointrow"];
    [aCoder encodeObject:[NSNumber numberWithBool:self.choose] forKey:@"choose"];
}
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self =[super init]) {
        self.starModelType = [[aDecoder decodeObjectForKey:@"starModelType"]intValue];
        self.mFrame = [[aDecoder decodeObjectForKey:@"mFrame"] CGRectValue];
        self.starPoint = StarPointMake([[aDecoder decodeObjectForKey:@"starPointcolumn"] integerValue], [[aDecoder decodeObjectForKey:@"starPointrow"] integerValue]);
        self.choose = [[aDecoder decodeObjectForKey:@"choose"] boolValue];
    }
    
    return  self;

}

@end
